@im-nobsidian/core 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +39 -4
- package/dist/index.js +825 -135
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Client } from '@notionhq/client';
|
|
3
|
-
import { PageObjectResponse, BlockObjectResponse, PartialBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints.js';
|
|
3
|
+
import { PageObjectResponse, BlockObjectResponse, PageMarkdownResponse, PartialBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints.js';
|
|
4
4
|
|
|
5
5
|
declare const ConfigSchema: z.ZodObject<{
|
|
6
6
|
version: z.ZodLiteral<1>;
|
|
@@ -339,6 +339,7 @@ declare class StateDB {
|
|
|
339
339
|
upsert(record: UpsertSyncRecord): SyncRecord;
|
|
340
340
|
updateStatus(id: string, status: SyncStatus): void;
|
|
341
341
|
updateHash(id: string, hash: string, snapshot?: Buffer | null): void;
|
|
342
|
+
setNotionLastEdited(id: string, lastEdited: string): void;
|
|
342
343
|
delete(id: string): void;
|
|
343
344
|
resolveWikilink(text: string): WikilinkEntry | null;
|
|
344
345
|
resolvePageId(pageId: string): WikilinkEntry | null;
|
|
@@ -383,7 +384,16 @@ declare class NotionClient {
|
|
|
383
384
|
properties?: Record<string, unknown>;
|
|
384
385
|
children?: BlockObjectResponse[];
|
|
385
386
|
}): Promise<PageObjectResponse>;
|
|
387
|
+
createPageWithMarkdown(params: {
|
|
388
|
+
parentId: string;
|
|
389
|
+
parentType: "page" | "database";
|
|
390
|
+
title: string;
|
|
391
|
+
markdown: string;
|
|
392
|
+
properties?: Record<string, unknown>;
|
|
393
|
+
}): Promise<PageObjectResponse>;
|
|
386
394
|
updatePageProperties(pageId: string, properties: Record<string, unknown>): Promise<PageObjectResponse>;
|
|
395
|
+
getPageMarkdown(pageId: string): Promise<PageMarkdownResponse>;
|
|
396
|
+
replacePageMarkdown(pageId: string, markdown: string): Promise<PageMarkdownResponse>;
|
|
387
397
|
getDatabaseSchema(databaseId: string): Promise<Record<string, {
|
|
388
398
|
id: string;
|
|
389
399
|
type: string;
|
|
@@ -406,11 +416,12 @@ declare class NotionClient {
|
|
|
406
416
|
fetchAllChildren(blockId: string): Promise<BlockObjectResponse[]>;
|
|
407
417
|
appendChildren(blockId: string, children: unknown[]): Promise<void>;
|
|
408
418
|
deleteBlock(blockId: string): Promise<void>;
|
|
419
|
+
uploadFile(fileData: Blob, filename: string, contentType: string): Promise<string>;
|
|
409
420
|
search(params: {
|
|
410
421
|
query?: string;
|
|
411
422
|
filter?: {
|
|
412
423
|
property: "object";
|
|
413
|
-
value: "page" | "
|
|
424
|
+
value: "page" | "data_source";
|
|
414
425
|
};
|
|
415
426
|
startCursor?: string;
|
|
416
427
|
pageSize?: number;
|
|
@@ -558,6 +569,7 @@ declare class ChangeDetector {
|
|
|
558
569
|
|
|
559
570
|
interface VaultFS {
|
|
560
571
|
readFile(path: string): Promise<string>;
|
|
572
|
+
readBinary(path: string): Promise<Buffer>;
|
|
561
573
|
writeFile(path: string, content: string): Promise<void>;
|
|
562
574
|
writeBinary(path: string, data: Buffer): Promise<void>;
|
|
563
575
|
deleteFile(path: string): Promise<void>;
|
|
@@ -597,7 +609,12 @@ declare class SyncOrchestrator {
|
|
|
597
609
|
private resolveNotionParent;
|
|
598
610
|
private isFolderNote;
|
|
599
611
|
private resolveParentPath;
|
|
612
|
+
private pushCreatePage;
|
|
613
|
+
private pushUpdatePage;
|
|
614
|
+
private fetchPageMarkdown;
|
|
600
615
|
private extractParentId;
|
|
616
|
+
private cleanupInterruptedSync;
|
|
617
|
+
private resolveUniqueFilePath;
|
|
601
618
|
}
|
|
602
619
|
|
|
603
620
|
interface PathFilterConfig {
|
|
@@ -611,6 +628,7 @@ declare class NodeVaultFS implements VaultFS {
|
|
|
611
628
|
constructor(rootPath: string, pathConfig?: PathFilterConfig);
|
|
612
629
|
private loadImNobsidianIgnore;
|
|
613
630
|
readFile(path: string): Promise<string>;
|
|
631
|
+
readBinary(path: string): Promise<Buffer>;
|
|
614
632
|
writeFile(path: string, content: string): Promise<void>;
|
|
615
633
|
writeBinary(path: string, data: Buffer): Promise<void>;
|
|
616
634
|
deleteFile(path: string): Promise<void>;
|
|
@@ -629,15 +647,24 @@ interface ImageDownloadResult {
|
|
|
629
647
|
readonly hash: string;
|
|
630
648
|
readonly size: number;
|
|
631
649
|
}
|
|
650
|
+
interface ImageUploadResult {
|
|
651
|
+
readonly localPath: string;
|
|
652
|
+
readonly fileUploadId: string;
|
|
653
|
+
}
|
|
632
654
|
declare class ImageHandler {
|
|
633
655
|
private readonly vaultFs;
|
|
634
656
|
private readonly attachmentFolder;
|
|
635
|
-
|
|
657
|
+
private readonly notionClient?;
|
|
658
|
+
constructor(vaultFs: VaultFS, attachmentFolder?: string, notionClient?: NotionClient | undefined);
|
|
636
659
|
downloadImage(url: string, pageTitle: string): Promise<ImageDownloadResult>;
|
|
637
660
|
downloadAllImages(markdown: string, pageTitle: string): Promise<{
|
|
638
661
|
content: string;
|
|
639
662
|
downloads: ImageDownloadResult[];
|
|
640
663
|
}>;
|
|
664
|
+
uploadLocalImage(localPath: string): Promise<ImageUploadResult>;
|
|
665
|
+
uploadAndAppendImages(pageId: string, images: ImageReference[]): Promise<ImageUploadResult[]>;
|
|
666
|
+
private readImageFromVault;
|
|
667
|
+
private getContentTypeFromPath;
|
|
641
668
|
private isNotionImageUrl;
|
|
642
669
|
private guessExtension;
|
|
643
670
|
}
|
|
@@ -696,9 +723,12 @@ declare class FrontmatterExtractor implements Processor {
|
|
|
696
723
|
process(input: ProcessorInput): ProcessorOutput;
|
|
697
724
|
}
|
|
698
725
|
|
|
726
|
+
type WikilinkResolverFn = (text: string) => WikilinkEntry | null;
|
|
699
727
|
declare class WikilinkResolver implements Processor {
|
|
728
|
+
private readonly resolve?;
|
|
700
729
|
readonly name = "WikilinkResolver";
|
|
701
730
|
readonly order = 20;
|
|
731
|
+
constructor(resolve?: WikilinkResolverFn | undefined);
|
|
702
732
|
process(input: ProcessorInput): ProcessorOutput;
|
|
703
733
|
}
|
|
704
734
|
|
|
@@ -791,6 +821,8 @@ declare class PropertiesTableRestorer implements Processor {
|
|
|
791
821
|
readonly name = "PropertiesTableRestorer";
|
|
792
822
|
readonly order = 5;
|
|
793
823
|
process(input: ProcessorInput): ProcessorOutput;
|
|
824
|
+
private restoreFromYaml;
|
|
825
|
+
private restoreFromTable;
|
|
794
826
|
}
|
|
795
827
|
|
|
796
828
|
interface MergeResult {
|
|
@@ -930,6 +962,9 @@ interface Logger {
|
|
|
930
962
|
declare function setLogger(logger: Logger): void;
|
|
931
963
|
declare function getLogger(): Logger;
|
|
932
964
|
|
|
933
|
-
|
|
965
|
+
interface PipelineOptions {
|
|
966
|
+
readonly wikilinkResolver?: WikilinkResolverFn;
|
|
967
|
+
}
|
|
968
|
+
declare function createDefaultPipeline(options?: PipelineOptions): ConversionPipeline;
|
|
934
969
|
|
|
935
970
|
export { BlockConverter, CalloutRestorer, CalloutTransformer, ChangeDetector, ColorAnnotator, type Config, ConfigManager, ConfigSchema, type Conflict, ConflictResolver, type ConflictStrategy, type ConversionContext, type ConversionPath, ConversionPipeline, type ConversionResult, DEFAULT_CONFIG, EmbedResolver, type FailedOperation, type FileInfo, type FileSystemEntry, type FileType, FileWatcher, FrontmatterExtractor, FrontmatterGenerator, HtmlAnnotationStripper, type ImageDownloadResult, ImageHandler, type ImageReference, InlineDBParser, type LocalChange, LocalImageRestorer, type Logger, type MappingResult, type MappingType, MathNormalizer, MentionToWikilink, type MergeConflictRegion, type MergeResult, NodeVaultFS, type NotionBlock, NotionBlockBuilder, NotionClient, type NotionClientOptions, type NotionPageNode, type NotionRichText, type RichTextItem as NotionRichTextItem, type OperationType, type PageCreationPlan, type PathFilterConfig, type PreserveMarker, PreserveMarkerCollector, PreserveMarkerInjector, type Processor, type ProcessorInput, type ProcessorMetadata, type ProcessorOutput, type ProgressCallback, PropertiesTableInjector, PropertiesTableRestorer, PropertyMapper, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoteChange, type ResolutionChoice, type ResolutionResult, type RichTextSegment, StateDB, type StatusResult, type SyncDirection, type SyncOptions, SyncOrchestrator, type SyncRecord, type SyncResult, type SyncStatus, TreeMapper, UnsupportedBlockStripper, type UpsertSyncRecord, type VaultFS, type WatchSyncOptions, WatchSyncService, type WikilinkEntry, WikilinkResolver, computeBufferHash, computeHash, createDefaultPipeline, generateId, getLogger, normalizeNotionId, notionIdsEqual, sanitizeFileName, setLogger, threeWayMerge };
|